<div class="list-body">
	<div class="row">
		<a class="add-btn device-btn mr-10" onclick="dialog_announcement_add()"><i class="fa fa-plus-square-o"></i><span>添加公告</span></a>
	</div>
	<div class="row">
		<table id="announcement-list" class="table table-bordered"></table>
	</div>
</div>
<script type="text/javascript">
	$(function(){
		$('#announcement-list').datagrid({
			height:'100%',
			width:'100%',
			tableWidth:'100%',
			gridTitle:'公告列表',
			filterThead : false,
			local:'remote',
			fieldSortable:false,
			dataUrl:'/announcement/list',
			columnResize:false,
			columns:[
			{
				name:'title',
	        	label:'标题',
	        	align:'center',
	        	menu:false,
	        	width:100
			},
			{
				name:'content',
	        	label:'内容',
	        	align:'center',
	        	menu:false,
	        	width:250
			},
			{
				name:'sendto',
	        	label:'发送对象',
	        	align:'center',
	        	menu:false,
	        	width:200
			},
			{
				name:'createdate',
	        	label:'创建时间',
	        	align:'center',
	        	menu:false,
	        	width:100
			},
			{
	            name: 'operation',
	            label: '操作',
	            align: 'center',
	            menu:false,
	            width:100,
	            render:function(value,data){
	            		return "<div class='operation-btn'><a title='删除' onclick='announcement_del("+JSON.stringify(data)+")'><i class='fa fa-trash-o'></i></a></div>"
	            	
	            }
	        }
			],
			paging:{pageSize:10,pageCurrent:1},
			showLinenumber:false
		})
	})
	function dialog_announcement_add(){
		BJUI.dialog({
			id:"announcementAdd",
			url:"/announcement/add",
			title:"添加公告",
			width:"800",
			height:"720",
			mask:true,
			maxable:false

		})
	}
	function announcement_del(obj){
		BJUI.alertmsg('confirm', '确定要删除吗！', {
	        okCall: function() {
	            $.ajax({
					url:'/announcement/del',
					type:'post',
					data:{'ids':[obj.id]},
					dataType:'json',
					success:function(data){
						BJUI.navtab('refresh', 'announcement')
					}

				})
	        }
	    })
	}
</script>